


import java.sql.Connection;
import java.sql.DriverManager;



/**
 * Servlet implementation class for Servlet: DbConnection
 *
 */
 public class DbConnection 
 {

	private String username = "root";
	private String password = "root";
	protected String dbsource = "jdbc:mysql://localhost/inventory"; 
	protected String drv = "com.mysql.jdbc.Driver";
	protected String defaultquery = "select * from item";
	
	public String getQuery()
	{
		return defaultquery;
	}
	
	public String getDriver()
	{
		return drv;
	}
	
	public DbConnection() {
		super();
	}   	
	
	public void setUsername(String x)
	{
		username = x;
	}
	
	public void setPassword(String x)
	{
		password = x;
	}
	
	public String getUsername()
	{
		return username;
	}
	
	public String getPassword()
	{
		return password;
	}
	
	public String getDbsource()
	{
		return dbsource;
	}
	


	public Connection getConnection() throws Exception
	{
		return DriverManager.getConnection(this.getDbsource(), this.getUsername(), this.getPassword());
	}
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	  	  	    
}